package com.dragon.app.design.pattern.singleton;

public class Test {

	public static void main(String[] args) {

		for (int i = 0; i < 1000; i++) {
			final int x = i;
			new Thread(new Runnable() {
				@Override
				public void run() {
					if (x > 500) {
						try {
							Thread.sleep(x - 500);
						} catch (InterruptedException e1) {
							e1.printStackTrace();
						}
					}

					Singleton3 singleton3 = Singleton3.getInstance();
					try {
						System.out.println(Thread.currentThread().getName() + ":" + singleton3.getA().toString());
						System.out.println(Thread.currentThread().getName() + ":" + singleton3.getB().toString());
						System.out.println(Thread.currentThread().getName() + ":" + singleton3.getC().toString());
					} catch (Exception e) {
						e.printStackTrace();
					}
				}
			}, String.valueOf(i)).start();
		}

	}

}
